<template>  
  <div>

  </div>
</template>

<script setup lang="ts">
// 接口readonly 只读属性
  interface Icity{
    readonly name:string,
    code:number,
    run():void
  }

  let city:Icity={
    name:'北京',
    code:1,
    run(){
      console.log('run');
    }
  }
// type是一种类型别名 type可以用于基础类型、联合类型、交叉类型等
 type tp=string|number|boolean
let str:tp="123"

type Iphone={
  name?:string,
  readonly price:number,
  call:()=>void
}
let myphone:Iphone={
  name:"小米",
  price:1999,
  call(){
    
  }
}
// type 用 & 完成合并类型  interface 用 extends 完成合并类型
type Ixiaomi=Iphone & {
    color:string,
    ram:number,
    pixel:number
}
let xiaomi:Ixiaomi={
   color:"黑色",
   ram:8,
   pixel:1999999,
   name:"小米15",
   price:34444,
   call(){}
}
// import type {FromType} from '@/types'


</script>